//module of admin
import { ADMIN, SUPERADMIN, PROJECT } from '@/services/api';
import { request, METHOD } from '@/utils/request';
/* 
获取所有管理员及其项目
*/
export async function getAllAdminProjectApi(params) {
  return request(SUPERADMIN + '/getAllAdminProject', METHOD.GET, params);
}

/*
根据班级查找项目
*/
export async function getProjectByGradeApi(params) {
  return request(SUPERADMIN + '/getProjectByGrade', METHOD.GET, params);
}

/* 
根据项目id查找项目下所有信息
*/
export async function getAdminProjectApi(params) {
  return request(PROJECT + '/getAll', METHOD.GET, params);
}

// 根据分类获取案例
export async function getAllCaseByClassifyApi(params) {
  return request(SUPERADMIN + '/getAllCaseByClassify', METHOD.GET, params);
}
// 根据人物id获取案例
export async function getAllCaseByCharacterApi(params) {
  return request(SUPERADMIN + '/getAllCaseByCharacter', METHOD.GET, params);
}

/*
获取所有
*/
// 获取所有案例
export async function getAllCarouselGroupAdminApi(params) {
  return request(SUPERADMIN + '/getAllCarouselGroup', METHOD.GET, params);
}
// 获取所有案例
export async function getAllCaseAdminApi(params) {
  return request(SUPERADMIN + '/getAllCase', METHOD.GET, params);
}
// 获取所有新闻
export async function getAllNewsAdminApi(params) {
  return request(SUPERADMIN + '/getAllNews', METHOD.GET, params);
}
// 获取所有招聘
export async function getAllRecruitAdminApi(params) {
  return request(SUPERADMIN + '/getAllRecruit', METHOD.GET, params);
}
// 获取所有关于我们
export async function getAllAboutUsAdminApi(params) {
  return request(SUPERADMIN + '/getAllAboutUs', METHOD.GET, params);
}
// 获取所有人物
export async function getAllCharacterAdminApi(params) {
  return request(SUPERADMIN + '/getAllCharacter', METHOD.GET, params);
}

/*
根据项目id获取
*/
//获取所有轮播图分组及分组下的轮播图
export async function getAllCarouselGroupByProjectIdApi(params) {
  return request(
    SUPERADMIN + '/getAllCarouselGroupByProjectId',
    METHOD.GET,
    params
  );
}
//获取所有案例
export async function getAllCaseByProjectIdApi(params) {
  return request(SUPERADMIN + '/getAllCaseByProjectId', METHOD.GET, params);
}
//获取所有新闻
export async function getAllNewsByProjectIdApi(params) {
  return request(SUPERADMIN + '/getAllNewsByProjectId', METHOD.GET, params);
}
//获取所有招聘
export async function getAllRecruitByProjectIdApi(params) {
  return request(SUPERADMIN + '/getAllRecruitByProjectId', METHOD.GET, params);
}
//获取所有人物
export async function getAllCharacterByProjectIdApi(params) {
  return request(
    SUPERADMIN + '/getAllCharacterByProjectId',
    METHOD.GET,
    params
  );
}
//获取所有关于我们
export async function getAllAboutUsByProjectIdApi(params) {
  return request(SUPERADMIN + '/getAllAboutUsByProjectId', METHOD.GET, params);
}
//获取所有分类
export async function getAllClassifyByProjectIdApi(params) {
  return request(SUPERADMIN + '/getAllClassifyByProjectId', METHOD.GET, params);
}

/*
根据id获取
*/
// 获取轮播图
export async function getCarouselByIdAdminApi(params) {
  return request(SUPERADMIN + '/getCarouselById', METHOD.GET, params);
}
// 获取案例
export async function getCaseByIdAdminApi(params) {
  return request(SUPERADMIN + '/getCaseById', METHOD.GET, params);
}
// 获取新闻
export async function getNewsByIdAdminApi(params) {
  return request(SUPERADMIN + '/getNewsById', METHOD.GET, params);
}
// 获取招聘信息
export async function getRecruitByIdAdminApi(params) {
  return request(SUPERADMIN + '/getRecruitById', METHOD.GET, params);
}

/*
根据id进行删除操作
*/
//删除轮播图分组
export async function deleteCarouselGroupApi(params) {
  return request(SUPERADMIN + '/deleteCarouselGroup', METHOD.DELETE, params);
}
//删除轮播图
export async function deleteCarouselApi(params) {
  return request(SUPERADMIN + '/deleteCarousel', METHOD.DELETE, params);
}
//删除案例
export async function deleteCaseApi(params) {
  return request(SUPERADMIN + '/deleteCase', METHOD.DELETE, params);
}
//删除新闻
export async function deleteNewsApi(params) {
  return request(SUPERADMIN + '/deleteNews', METHOD.DELETE, params);
}
//删除招聘信息
export async function deleteRecruitApi(params) {
  return request(SUPERADMIN + '/deleteRecruit', METHOD.DELETE, params);
}
//删除人物
export async function deleteCharacterApi(params) {
  return request(SUPERADMIN + '/deleteCharacter', METHOD.DELETE, params);
}
//删除关于我们
export async function deleteAboutUsApi(params) {
  return request(SUPERADMIN + '/deleteAboutUs', METHOD.DELETE, params);
}
//删除分类
export async function deleteClassifyApi(params) {
  return request(SUPERADMIN + '/deleteClassify', METHOD.DELETE, params);
}
/* 
--edit adminInfo-- 
*/
export async function editInfoApi(params) {
  return request(ADMIN + '/edit', METHOD.PUT, params);
}
/* 
--reset password--
*/
export async function resetPwdApi(oldPassword, newPassword) {
  return request(ADMIN + '/resetPassword', METHOD.PUT, {
    oldPassword,
    newPassword,
  });
}
export default {
  getAllAdminProjectApi,
  getAdminProjectApi,
  getAllCarouselGroupAdminApi,
  getAllCaseAdminApi,
  getAllNewsAdminApi,
  getAllRecruitAdminApi,
  getAllCarouselGroupByProjectIdApi,
  getAllCaseByProjectIdApi,
  getAllNewsByProjectIdApi,
  getAllRecruitByProjectIdApi,
  deleteCarouselGroupApi,
  deleteCarouselApi,
  deleteCaseApi,
  deleteNewsApi,
  deleteRecruitApi,
  editInfoApi,
  resetPwdApi,
};
